package controller;

import entity.Comptype;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.ComptypeService;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/comp")
public class ComptypeCon {
    @Resource(name="comptypeService")
    private ComptypeService comptypeService;

    @RequestMapping("/query")
    @ResponseBody
    public List<Comptype> list(){
        return comptypeService.list();
    }

    @RequestMapping("/add")
    @ResponseBody
    public List<Comptype> add(String name){
        int i = comptypeService.add(name);
        return list();
    }

}
